#ifndef MY_DEFS_H
#define MY_DEFS_H

#include <QString>
#include <QStringList>
/*
    Macroses and constants
*/

#define APP_DIR (QDir::toNativeSeparators(QDir::currentPath()))
#define LOG( x, y, z ) Logger::instance()->add(x, y, z)

const QString ORGANIZATION("TroPro");
const QString APP_NAME("QDisco");
const QString MY_TABLE_STRUCT_IN_SQL("CREATE TABLE IF NOT EXISTS lps (uniqId INTEGER PRIMARY KEY ASC, " \
    "caption text NOT NULL, styleId integer NOT NULL, comment text);");

const QString SEARCH_LIKE("SELECT uniqId, caption, styleId, comment FROM lps " \
    "WHERE caption LIKE '\%%1\%' ORDER BY uniqId ASC");

const QString GET_RECORD_BY_UNIQID("SELECT uniqId, caption, styleId, comment FROM lps WHERE uniqId=:uniqId");

const QString GET_PARENTS_QUERY("SELECT styleId FROM lps GROUP BY styleId");

const QString GET_ITEMS_BY_STYLE("SELECT uniqId, caption, styleId, comment FROM lps "\
    "WHERE styleId=:styleId ORDER BY uniqId ASC");

const QString DELETE_RECORD("DELETE FROM lps WHERE uniqId=:uniqId");

const QString INSERT_RECORD("INSERT INTO lps VALUES (:uniqId, :caption, :styleId, :comment)");

const QString CHANGE_RECORD("UPDATE lps SET caption=:caption, styleId=:styleId, comment=:comment WHERE uniqId=:uniqId");

const QString FIND_NEXT_FREE_ID("SELECT MAX(uniqId)+1 FROM lps");

const int COL_COUNT = 4;

const int PARENT_HEIGHT = 56;
const int CHILD_HEIGHT = 24;

const QStringList COL_NAMES = (QStringList()
                               << QString::fromUtf8("Унік. ід.")
                               << QString::fromUtf8("Назва")
                               << QString::fromUtf8("Стиль")
                               << QString::fromUtf8("Коментар"));

enum {AllStylesLoaded, SomeStylesLoaded, NoStylesLoaded};

#endif // MY_DEFS_H
